package com.edu.service.impl;

import java.util.List;

import com.edu.bean.Cars;
import com.edu.bean.Carsdata;
import com.edu.bean.Orders;
import com.edu.bean.Page;
import com.edu.dao.CarDao;
import com.edu.dao.impl.CarDaoImpl;
import com.edu.service.CarService;

public class CarsServiceImpl implements CarService {
	CarDao cd = new CarDaoImpl();
	@Override
	public Page<Cars> getAll(Cars car,int pageNum,int pageSize) {
		List<Cars> carspage=cd.getAll(pageNum, pageSize);
		int rows=cd.selectUserAll(car);
		Page<Cars> page=new Page(carspage,pageNum, pageSize,rows);
		return page;
	}
	@Override
	public Cars getById(int id) {
		// TODO Auto-generated method stub
		return cd.getById(id);
	}

	@Override
	public int update(Cars car) {
		// TODO Auto-generated method stub
		return cd.update(car);
	}

	@Override
	public int delete(int id) {
		// TODO Auto-generated method stub
		return cd.delete(id);
	}

	@Override
	public int addcars(Cars cars) {
		// TODO Auto-generated method stub
		return cd.addcar(cars);
	}

	@Override
	public Carsdata<Cars> selectCarsAll() {
		int carsjc = cd.selectCarjc();
		int carspc = cd.selectCarpc();
		int carssvu = cd.selectCarSuv();
		Carsdata<Cars> listcarsdata = new Carsdata(carspc,carsjc,carssvu);
		return listcarsdata;
	}
}
